package tk.pak0.audiomidifier.view.action;

import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;

import javax.swing.DefaultComboBoxModel;
import javax.swing.JComboBox;

import tk.pak0.audiomidifier.controller.Controller;

public class ComboTarjetas extends FocusAdapter {
	
	Controller mainControl;
	JComboBox comboEntradas;
	
	public ComboTarjetas(Controller con, JComboBox comb){
		mainControl = con;
		comboEntradas = comb;
	}
	
	public void focusLost(FocusEvent event) {
		comboTarjetasFocusFocusLost(event);
	}
	
	private void comboTarjetasFocusFocusLost(FocusEvent event) {
		JComboBox combo = (JComboBox)event.getComponent();
		int index = combo.getSelectedIndex();
		
		// Rellenarmos el combo de entradas de audio / We fill the source audio lines combo
		comboEntradas.setModel(new DefaultComboBoxModel(mainControl.getInputLinesNamesFromMixerIndex(index)));
	}
	
}
